import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)
// //获取原型对象上的push函数
// const originalPush = VueRouter.prototype.push
// //修改原型对象中的push方法
// VueRouter.prototype.push = function push(location) {
//    return originalPush.call(this, location).catch(err => err)
// }

const routes = [{
        path: '/',
        name: '登录',
        // component: () => import('../view/login/index'),
        component: resolve=>require(['../view/login/index'],resolve),
        hidden: true
    },
    {
        path: '/home',
        name: '审查员管理',
        // component: () => import('../view/admin/index'),
        component: resolve=>require(['../view/admin/index'],resolve),
        children: [{
                path: '/examinerList',
                name: '审查员信息',
                // component: () => import('../view/admin/examiner/examinerList'),
                component: resolve=>require(['../view/admin/examiner/examinerList'],resolve)
            },
            {
                path: '/saveExaminerInfo',
                name: '添加审查员',
                // component: () => import('../view/admin/examiner/saveExaminerInfo'),
                component: resolve=>require(['../view/admin/examiner/saveExaminerInfo'],resolve)
            },
            // {
            //     path:'',
            //     // redirect:'/home',
            //     component: () => import('../view/admin/hello'),
            // }
        ]
    },
    {
        path: '/home',
        name: '推广业务',
        // component: () => import('../view/admin/index'),
        component: resolve=>require(['../view/admin/index'],resolve),
        children: [{
                path: '/videoList',
                name: '视频推广',
                // component: () => import('../view/admin/videoPromotion/videoList'),
            component: resolve=>require(['../view/admin/videoPromotion/videoList'],resolve)
            },
            {
                path: '/alreadPromotion',
                name: '已推广视频',
                // component: () => import('../view/admin/videoPromotion/alreadPromotion'),
                component: resolve=>require(['../view/admin/videoPromotion/alreadPromotion'],resolve)
            }
        ]
    },
    {
        path: '/home',
        name: '统计管理',
        // component: () => import('../view/admin/index'),
        component: resolve=>require(['../view/admin/index'],resolve),
        children: [{
                path: '/staindex',
                name: '生成数据',
                // component: () => import('../view/admin/dataStatistics/index'),
            component: resolve=>require(['../view/admin/dataStatistics/index'],resolve)
            },
            {
                path: '/onlinePer',
                name: '数据统计',
                // component: () => import('../view/admin/dataStatistics/onlinePer'),
                component: resolve=>require(['../view/admin/dataStatistics/onlinePer'],resolve)
            },
            {
                path: '/topRank',
                name: '点赞排行',
                // component: () => import('../view/admin/dataStatistics/topRank')
                component: resolve=>require(['../view/admin/dataStatistics/topRank'],resolve)
            },
            {
                path: '/topRankList',
                name: '播放排行',
                // component: () => import('../view/admin/dataStatistics/topRankList')
                component: resolve=>require(['../view/admin/dataStatistics/topRankList'],resolve)
            }
        ]
    },
    {
        path: '/home',
        name: '系统通知',
        // component: () => import('../view/admin/index'),
        component: resolve=>require(['../view/admin/index'],resolve),
        children: [{
            path: '/sysInform',
            name: '系统消息',
            // component: () => import('../view/admin/sysInform'),
            component: resolve=>require(['../view/admin/sysInform'],resolve)
        }, ]
    },
    {
        path: '/home',
        // name: 'Home',
        hidden: true,
        // component: () => import('../view/admin/index'),
        component: resolve=>require(['../view/admin/index'],resolve),
        children: [{
            path: '/adminInfo',
            name: '个人中心',
            // component: () => import('../view/admin/adminInfo')
            component: resolve=>require(['../view/admin/adminInfo'],resolve)
        }]
    },
    {
        path: '/home',
        // name: 'Home',
        hidden: true,
        // component: () => import('../view/admin/index'),
        component: resolve=>require(['../view/admin/index'],resolve),
        children: [{
            path: '/hello',
            // component: () => import('../view/admin/hello')
            component: resolve=>require(['../view/admin/hello'],resolve),
        }]
    }


]

const router = new VueRouter({
    routes
})

export default router
